<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
     <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<html lang="en">
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"+ request.getServerName() + ":" + request.getServerPort()+ path + "/";
%> 
    <head>
        <meta charset="utf-8">
        <meta http-equiv="X-UA-Compatible" content="IE=9">
        <link rel="stylesheet" href="<%=basePath %>css/cssreset.css">
        <link rel="stylesheet" href="<%=basePath %>css/yewucanshu.css">
        <script src="<%=basePath %>js/jquery-1.11.1.min.js"></script>
        <script src="<%=basePath %>js/menu.js"></script>
        <style type="text/css">
		.psxa{
			color:#708dac;
			width:100%;
			line-height:23px;
			text-align: center;
			margin-top:27px;
			font-family: '微软雅黑';
			cursor:pointer;
			font-size:16px;
		}
		.psxa>a{
			text-decoration:none;
			color:#708dac;
		}
		.ims{
			position:relative;
			top:4px;
			right:22px;
		}
    </style>
    </head>
    <body>
    	<div class="headers">
    		<p class="pa">客户管理系统CRM</p>
    		<p class="rights">
	    		<img src="<%=basePath %>images/user.png" alt="">
	    		${staff.staff_name}
	    		<button onclick="ind()"></button>
    		</p>
    	</div>
    	<section>
    		<ol class="lefts">
    			<li class="pb">
    				<img src="<%=basePath %>images/Users and permissions.png" alt="">
    				用户和权限
    				<img src="<%=basePath %>images/button (2).png" alt="">
    				<div class="div1">
    					<p class="zcd" id="zcd1"><a href="<%=basePath %>role/page.action">角色管理</a></p>
						<p class="zcd" id="zcd2"><a href="<%=basePath %>staff/selectTree.action">部门/用户管理</a></p>
    				</div>
    			</li>
    			<li class="px">
    				<img src="<%=basePath %>images/canshu.png" alt="">
    				业务参数和设定
    				<img src="<%=basePath %>images/button (2).png" alt="">
    				<div class="div1"  style="display:block;">
    				<p class="zcd" id="zcd1" name="ppa"><a href="<%=basePath %>tradeManage/select.action"  style="color:#fff;">行业管理</a></p>
						<p class="zcd" id="zcd2" name="ppa"><a href="<%=basePath %>compactGenre/select.action">合同类型</a></p>
						<p class="zcd" id="zcd1" name="ppa"><a href="<%=basePath %>rank/select.action">客户级别</a></p>
						<p class="zcd" id="zcd2" name="ppa"><a href="<%=basePath %>record/select.action">记录类型</a></p>
						<p class="zcd" id="zcd2" name="ppa"><a href="<%=basePath %>salestage/select.action">销售阶段</a></p>
    				</div>
    			</li>
    			<li class="py">
    				<img src="<%=basePath %>images/liucheng.png" alt="">
    				流程管理
    				<img src="<%=basePath %>images/button (2).png" alt="">
    				<div class="div1">
    						<p class="zcd" id="zcd1"><a href="<%=basePath %>approveRole/select.action">审批流程管理</a></p>
    				</div>
    			</li>
    			<li class="pxa">
                    <img src="../images/gonggao.png" alt="" width="18px">
                    <a href="../notice/page.action" style="color:#708dac;text-decoration: none;">公告管理&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</a>
                </li>
                <li class="pxaa">
                    <img src="../images/kehu (1).png" alt="">
                    		资源开发
                    <img src="../images/button (2).png" alt="">
                    <div class="div1">
                        <p class="zcd" id="zcd1"><a href="<%=basePath %>client/weifencount.action?zhuizong=0">用户开发</a></p>
                        <p class="zcd" id="zcd2"><a href="../client/findByAllForAgent.action?start=1">代理开发</a></p>
                    </div>
                </li>
               <!--  <li class="pxas">
    				<img src="../images/kehuzilao.png" alt="">
    				客户资料
    				<img src="../images/button (2).png" alt="">
    				<div class="div1" >
    					<p class="zcd" id="zcd1"><a href="../html/gerenzilao.html">用户资料</a></p>
						<p class="zcd" id="zcd2"><a href="../html/kehuziliao.html">代理资料</a></p>
    				</div>
    			</li> -->
    			<li class="psxa">
    				<img src="../images/operation-management.png" alt="" width="16px" class="ims">
    				<a href="<%=basePath %>Operate/count1.action">运营管理&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</a>
    			</li> 
    		</ol>
    		<div class="righta">
    			<div class="smalls">
    				<ul>
		    			<li name="oli">
		    				<p class="hangye">行业管理</p>
		    				<div class="xiangqi">		    				
		    				<c:forEach var="list" items="${list}">
    						<p>
			    					<input class="inpt ${list.tradeManageId}" type="text" value="${list.tradeName}" disabled="disabled" >
			    					<img src="<%=basePath %>images/edit.png" alt="">
			    					<img src="<%=basePath %>images/queding.png" alt="" id="${list.tradeManageId}" onclick="cc(this)" class="imgs">
			    					<img src="<%=basePath %>images/delete.png" id="${list.tradeManageId}" onclick="bb(this)" alt="">
		    					</p>
    						</c:forEach>  	    							    					
		    					<form action="<%=basePath %>tradeManage/insert.action" method="post"  onsubmit="return aa()">
		    						<input type="text"  id="txt" name="tradeName">
		    						<input type="submit" value="添加">
		    					</form>
		    				</div>
		    			</li>
		    		</ul>
    			</div>
    		</div>    		
    	</section>
    </body>
    <script>
    function ind(){
    	window.location.href= "../notice/findByAll.action";
    }
    	$('.xiangqi>p>img:nth-of-type(1)').click(function(event) {
    		$('.xiangqi>p>input').css('border', '1px solid #ddd');
    		$(this).parent().siblings('').children('.inpt').css('border', 'none');
    		$(this).siblings('input').removeAttr('disabled');
    		$(this).parent().siblings('').children('.inpt').attr('disabled', 'disabled');
    		$(this).css('display', 'none');
    		$(this).parent().siblings('').children('.xiangqi>p>img:nth-of-type(1)').css('display', 'inline');
    		$(this).siblings('.imgs').css('display', 'inline');
    		$(this).parent().siblings('').children('.imgs').css('display', 'none');
    	});
    	$('.imgs').click(function(event) {
    		$('.xiangqi>p>input').css('border', 'none');
    		$(this).siblings('.inpt').attr('disabled', 'disabled');
    		$(this).css('display', 'none');
    		$(this).siblings('.xiangqi>p>img:nth-of-type(1)').css('display', 'inline');
    	});
    	function bb(obj){//删除
    		var id=obj.id; 
    		window.location.href="<%=basePath %>tradeManage/deletes.action?id="+id; 
    	}
    	function cc(obj){//更新
    		var vals=$( '.'+obj.id+'').val();
    		var id=obj.id;
    		window.location.href="<%=basePath %>tradeManage/updata.action?tradeManageId="+id+"&tradeName="+vals;
    	}
        	var txt=document.getElementById('txt');
        	function aa(){
        		var txts=txt.value;
        		var val=true;
        		var pattern= /\s/;
        		if(txts==''||pattern.test(txts)){
        			alert('文本框不能为空！');
        			val=val&&false;
        		}
        		return val;
        	}
    </script>
</html>